﻿/*****************************************************************//**
 * @file   VAOneXMLAdaptorSpectra.h
 * @brief  VAOne读写适配器频谱
 * 
 * @author XingXuanCi (xingxuanci@diso.cn)
 * @date   2024-10-30
 *********************************************************************/
#ifndef VAONEXMLADAPTORSPECTRA_H
#define VAONEXMLADAPTORSPECTRA_H

#include "FITKVAOneXMLIOAPI.h"
#include "FITKAbstractVAOneXMLAdaptor.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include "FITKAcousticsPhysics/FITKAcousticsAbstractSpectra.h"


//namespace Acoustics
//{
//class FITKAcousticsAbstractSpectra;
//}

namespace IO
{
    /**
     * @brief   VAOne读写适配器频谱
     * @author  XingXuanCi (xingxuanci@diso.cn)
     * @date    2024-10-30
     */
    class FITKVAOneXMLIOAPI VAOneXMLAdaptorSpectra : public FITKAbstractVAOneXMLAdaptor
    {
        FITKCLASS(IO, VAOneXMLAdaptorSpectra);
    public:

        /**
         * @brief   构造函数
         * @author  XingXuanCi (xingxuanci@diso.cn)
         * @date    2024-10-16
         */
        explicit VAOneXMLAdaptorSpectra()= default;

        /**
         * @brief   析构函数
         * @author  XingXuanCi (xingxuanci@diso.cn)
         * @date    2024-10-16
         */
        ~VAOneXMLAdaptorSpectra() = default;

        /**
         * @brief   适配器读数据
         * @return  是否执行成功
         * @author  XingXuanCi (xingxuanci@diso.cn)
         * @date    2024-10-22
         */
        bool adaptR() override;

        /**
         * @brief   适配器写数据
         * @return  是否执行成功
         * @author  XingXuanCi (xingxuanci@diso.cn)
         * @date    2024-10-22
         */
        bool adaptW() override;

    private:
        /**
         * @brief   读取实部频谱数据
         * @return  是否执行成功
         * @author  XingXuanCi (xingxuanci@diso.cn)
         * @date    2024-10-30
         */

        bool readRealSpectrum();
        /**
         * @brief   写实部频谱数据
         * @return  是否执行成功
         * @author  XingXuanCi (xingxuanci@diso.cn)
         * @date    2024-10-30
         */
        bool writeRealSpectrum();
        /**
         * @brief   写出频谱模版
         * @param   t 频谱类型
         * @return  是否执行成功
         * @author  XingXuanCi (xingxuanci@diso.cn)
         * @date    2024-11-09
         */
        bool writeRealSpectrumTemplate(Acoustics::FITKAcousticsAbstractSpectra::AcousticsSpectraType t);
        /**
         * @brief   传入的整型类型转换为频谱类型枚举
         * @param[i]   type 传入的整型
         * @return  频谱类型枚举
         * @author  XingXuanCi (xingxuanci@diso.cn)
         * @date    2024-11-09
         */
        Acoustics::FITKAcousticsAbstractSpectra* getSpectraByType(int type);
    };

    Register2FITKIOAdaptorFactory(VAOneXML, Acoustics::FITKAcousticsSpectraManager, VAOneXMLAdaptorSpectra)
}

#endif // VAONEXMLADAPTORSPECTRA_H
